package com.msk.web.controller.wlhy.station;

import com.msk.common.core.controller.BaseController;
import com.msk.common.core.domain.R;
import com.msk.common.utils.StringUtils;
import com.msk.station.domain.HtStation;
import com.msk.station.service.HtStationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Api("加油站管理")
@RestController
@RequestMapping("/api/htStations")
public class HtStationController extends BaseController {

    @Autowired
    private HtStationService htStationService;


    @ApiOperation("加油站列表")
    @PostMapping("/list")
    public R<?> getList(@RequestBody HtStation htStation) {
        List<HtStation> list = htStationService.findList(htStation);
        return R.appOk(list);
    }


    @ApiOperation("加油站详情")
    @PostMapping("/get")
    public R<?> get(@RequestBody Map<String, Object> params) {
        String id = StringUtils.getString(params.get("id"));
        if (StringUtils.isBlank(id)) {
            return R.appFail(400101, "请求参数加油站ID#id为空");
        }
        return R.appOk(htStationService.get(id));
    }

}
